<?php

class API_Controller extends CI_Controller {

    protected $data = array();
    protected $params = array();

    public function __construct() {
        parent::__construct();
        if ($this->valid_token() == FALSE) {
            $this->response('INVALID_TOKEN');
        }else{
            $this->params = $this->input->get(NULL, TRUE);
        }
    }

    private function valid_token() {
        return TRUE;
    }

    protected function response($message, $data = NULL) {
        $response['code'] = $message == 'GET_SUCCESS' ? 100000 : 100001;
        $response['message'] = $message;
        $response['data'] = $data;
        header('Content-type: application/json');
        echo json_encode($response);
        exit;
    }

}
